package com.jiang.daily.Q2176;

/**
 * @author Jiang
 * @version 1.0
 * @date 2025/04/17 15:35
 */
public class Solution {
    public int countPairs(int[] nums, int k) {
        int len = nums.length;
        int res = 0;
        for (int i = 0; i < len; i++) {
            for (int j = i + 1; j < len; j++) {
                if (nums[i] == nums[j] && (i * j) % k == 0)  {
                    res++;
                }
            }
        }
        return res;
    }
}
